package kd.comt.plugin;

import java.util.EventObject;

import kd.bos.form.ShowType;
import kd.bos.form.container.Tab;
import kd.bos.form.control.events.TabSelectEvent;
import kd.bos.form.control.events.TabSelectListener;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.list.ListShowParameter;

public class ThreeMeetingOneCourse extends AbstractFormPlugin implements TabSelectListener {
    // 待打开的页面
    private static String zbwydh_KEY_FORMID = "bpgx_zbdydh01";
    private static String zbwydh_TITLE_zr = "支部委员大会";

    private static String zbdydh_KEY_FORMID = "bpgx_zbdydh";
    private static String zbdydh_TITLE_zr = "支部党员大会";

    private static String dxzh_KEY_FORMID = "bpgx_dxzh";
    private static String dxzh_TITLE_zr = "党小组会";

    private static String dk_KEY_FORMID = "bpgx_dk";
    private static String dk_TITLE_zr = "党课";

    public void registerListener(EventObject e) {
        // 页签控件添加监听事件
        Tab tab = this.getView().getControl("bpgx_tabap");
        tab.addTabSelectListener(this);
    }
        //界面初始化或刷新，新建数据包完毕后，触发此事件
        @Override
        public void afterCreateNewData(EventObject e) {
            // TODO Auto-generated method stub
            super.afterCreateNewData(e);
            ListShowParameter list1 = new ListShowParameter();
            list1.setFormId("bos_list");
            list1.setBillFormId(zbwydh_KEY_FORMID);
            list1.getOpenStyle().setShowType(ShowType.InContainer);
            list1.getOpenStyle().setTargetKey("bpgx_zbwydh");
            this.getView().showForm(list1);
        }

    @Override
    public void tabSelected(TabSelectEvent arg0) {
        // TODO Auto-generated method stub
        // 点击页签的key
        String subTabKey = arg0.getTabKey();
        switch (subTabKey) {
            case "bpgx_zbwydh":
                ListShowParameter list1 = new ListShowParameter();
                list1.setFormId("bos_list");
                list1.setBillFormId(zbwydh_KEY_FORMID);
                list1.getOpenStyle().setShowType(ShowType.InContainer);
                list1.getOpenStyle().setTargetKey("bpgx_zbwydh");
                this.getView().showForm(list1);

            case "bpgx_zbdydh":
                ListShowParameter list2 = new ListShowParameter();
                list2.setFormId("bos_list");
                list2.setBillFormId(zbdydh_KEY_FORMID);
                list2.getOpenStyle().setShowType(ShowType.InContainer);
                list2.getOpenStyle().setTargetKey("bpgx_zbdydh");
                this.getView().showForm(list2);

            case "bpgx_dxzh":
                ListShowParameter list3 = new ListShowParameter();
                list3.setFormId("bos_list");
                list3.setBillFormId(dxzh_KEY_FORMID);
                list3.getOpenStyle().setShowType(ShowType.InContainer);
                list3.getOpenStyle().setTargetKey("bpgx_dxzh");
                this.getView().showForm(list3);
            case "bpgx_dk":
                ListShowParameter list4 = new ListShowParameter();
                list4.setFormId("bos_list");
                list4.setBillFormId(dk_KEY_FORMID);
                list4.getOpenStyle().setShowType(ShowType.InContainer);
                list4.getOpenStyle().setTargetKey("bpgx_dk");
                this.getView().showForm(list4);

        }

    }

}
